﻿@model XHouse.Model.Aparatos.Aparato

@{
    ViewBag.Title = "Nuevo Aparato";
}


<div class="row">
    <div class="col-xs-12 col-md-10 col-md-offset-1">
        <div class="page-header">
            <h3>Datos del nuevo aparato</h3>
        </div>
        @using (Html.BeginForm(null, null, FormMethod.Post, new { @class = "form-horizontal", @role = "form" }))
        {
            //@Html.ValidationSummary(true)

            if (ViewData.ModelState != null && !ViewData.ModelState.IsValid)
            { 
            <div class="alert alert-danger alert-dismissable">
                <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                @Html.ValidationSummary(false, "Errores:")
            </div>
            }
        
            
            <div class="form-group">
                <label for="Numero" class="col-lg-2 control-label">Número</label>
                <div class="col-lg-3">
                    @Html.TextBoxFor(model => model.Numero, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Numero, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            <div class="form-group">
                <label for="Nombre" class="col-lg-2 control-label">Nombre</label>
                <div class="col-lg-3">
                    @Html.TextBoxFor(model => model.Nombre, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Nombre, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            <div class="form-group">
                <label for="Descripcion" class="col-lg-2 control-label">Descripción</label>
                <div class="col-lg-3">
                    @Html.TextBoxFor(model => model.Descripcion, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Descripcion, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            
            <div class="form-group">
                <div class="col-lg-offset-2 col-lg-3">
                    <div class="checkbox">
                        <label>
                            @Html.CheckBoxFor(model => model.Habilitado) Habilitado
                        </label>
                    </div>
                </div>
            </div>
        
            <div class="form-group">
                <label for="Tipo" class="col-lg-2 control-label">Tipo</label>
                <div class="col-lg-3">
                    @Html.DropDownListFor(model => model.TipoAparatoId, new SelectList(ViewBag.TiposAparatos, "Id", "Nombre"), new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.TipoAparatoId, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            
            <div class="form-group">
                <label for="Zona" class="col-lg-2 control-label">Zona</label>
                <div class="col-lg-3">
                    @Html.DropDownListFor(model => model.ZonaId, new SelectList(ViewBag.Zonas, "Id", "Nombre"), new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.ZonaId, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            
            <div class="form-group">
                <label for="Modulo" class="col-lg-2 control-label">Módulo</label>
                <div class="col-lg-3">
                    @Html.DropDownListFor(model => model.ModuloId, new SelectList(ViewBag.Modulos, "Id", "Nombre"), new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.ModuloId, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            
            <div class="form-group">
                <label for="Ambiente" class="col-lg-2 control-label">Ambiente</label>
                <div class="col-lg-3">
                    @Html.DropDownListFor(model => model.AmbienteId, new SelectList(ViewBag.Ambientes, "Id", "Nombre"), new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.AmbienteId, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            
            <div class="form-group">
                <label for="Puerto" class="col-lg-2 control-label">Puerto</label>
                <div class="col-lg-3">
                    @Html.TextBoxFor(model => model.Puerto, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Puerto, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>
            
            <div class="form-group">
                <label for="Posicion" class="col-lg-2 control-label">Posición del puerto </label>
                <div class="col-lg-3">
                    @Html.TextBoxFor(model => model.Posicion, new { @class = "form-control" })
                    @Html.ValidationMessageFor(model => model.Posicion, String.Empty, new { @class = "help-block", @style = "color: red;" })
                </div>
            </div>

            <div class="form-group">
                <div class="col-lg-offset-2 col-lg-3">
                    <button class="btn btn-primary">Guardar</button>
                    <a class="btn btn-danger" href="@Url.Action("Index")">Cancelar</a>
                </div>
            </div>
        }

    </div>
</div>
@*@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Nuevo Aparato</legend>

        @Html.LabelFor(model => model.Nombre)
        <div>
            @Html.EditorFor(model => model.Nombre)
            @Html.ValidationMessageFor(model => model.Nombre)
        </div>
        @Html.Label(" Descripción de Aparato")
        <div>
            @Html.EditorFor(model => model.Descripcion)
            @Html.ValidationMessageFor(model => model.Descripcion)
        </div>

        @Html.Label("Zona del aparato")
        <div>
          @Html.DropDownListFor(model => model.ZonaId, new SelectList(ViewBag.Zonas, "Id", "Nombre"));
          @Html.ValidationMessageFor(model => model.ZonaId)
        </div>
      
        @Html.Label("Tipo de Aparato")
        <div>
            @Html.DropDownListFor(model => model.TipoAparatoId, new SelectList(ViewBag.TiposAparatos, "Id", "Nombre"))
            @Html.ValidationMessageFor(model => model.TipoAparatoId)
        </div>

      <button class="win-command">
            <span class="win-commandimage win-commandring">R</span>
            <span class="win-label">Guardar</span>
        </button>

        <a class="win-command" href="@Url.Action("Index")">
            <span class="win-commandimage win-commandring">U</span>
            <span class="win-label">Cancelar</span>
        </a>
    </fieldset>*@
}
